/*
 * Class50_Sub1_Sub4_Sub5 - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
public class Class50_Sub1_Sub4_Sub5 extends Class50_Sub1_Sub4 {
	private boolean aBoolean1714 = false;
	private int anInt1715;
	private int anInt1716;
	private int anInt1717;
	private int anInt1718;
	private int anInt1719;
	private int anInt1720;
	private int anInt1721;
	private int anInt1722;
	public static Client aClient1723;
	private Sequence sequence;
	int anInt1725;
	int anInt1726;
	int[] anIntArray1727;
	private int anInt1728;
	private int anInt1729;
	private int anInt1730;

	public final ObjectDefinition method614(int i) {
		int i_0_ = -1;
		if (i != 0) {
			anInt1728 = 109;
		}
		if ((this).anInt1725 != -1) {
			VarBit varBit = (VarBit.aVarBitArray824[(this).anInt1725]);
			int i_1_ = varBit.anInt826;
			int i_2_ = varBit.anInt827;
			int i_3_ = varBit.anInt828;
			int i_4_ = Client.anIntArray1214[i_3_ - i_2_];
			i_0_ = Class50_Sub1_Sub4_Sub5.aClient1723.anIntArray1039[i_1_] >> i_2_ & i_4_;
		} else if ((this).anInt1726 != -1) {
			i_0_ = (Class50_Sub1_Sub4_Sub5.aClient1723.anIntArray1039[(this).anInt1726]);
		}
		if (i_0_ < 0 || i_0_ >= (this).anIntArray1727.length || (this).anIntArray1727[i_0_] == -1) {
			return null;
		}
		return ObjectDefinition.method434((this).anIntArray1727[i_0_]);
	}

	public Class50_Sub1_Sub4_Sub5(int i, int i_5_, int i_6_, int i_7_, int i_8_, byte i_9_,
		int i_10_, boolean bool, int i_11_, int i_12_) {
		anInt1720 = i_10_;
		anInt1721 = i_8_;
		anInt1722 = i_12_;
		anInt1715 = i_11_;
		anInt1716 = i_7_;
		anInt1717 = i_5_;
		anInt1718 = i_6_;
		if (i != -1) {
			sequence = Sequence.sequences[i];
			anInt1730 = 0;
			anInt1729 = Client.anInt1325 - 1;
			if (bool && sequence.anInt298 != -1) {
				anInt1730 = (int) (Math.random() * sequence.anInt294);
				anInt1729 -= (int) (Math.random() * sequence.method205(0, anInt1730));
			}
		}
		ObjectDefinition objectDefinition = ObjectDefinition.method434(anInt1720);
		(this).anInt1725 = objectDefinition.anInt778;
		(this).anInt1726 = objectDefinition.anInt781;
		(this).anIntArray1727 = objectDefinition.anIntArray805;
		if (i_9_ != 3) {
			anInt1719 = -126;
		}
	}

	@Override
	public final Model method572(byte i) {
		if (i != 3) {
			aBoolean1714 = !aBoolean1714;
		}
		int i_13_ = -1;
		if (sequence != null) {
			int i_14_ = Client.anInt1325 - anInt1729;
			if (i_14_ > 100 && sequence.anInt298 > 0) {
				i_14_ = 100;
			}
			while (i_14_ > sequence.method205(0, anInt1730)) {
				i_14_ -= sequence.method205(0, anInt1730);
				anInt1730++;
				if (anInt1730 >= sequence.anInt294) {
					anInt1730 -= sequence.anInt298;
					if (anInt1730 < 0 || anInt1730 >= sequence.anInt294) {
						sequence = null;
						break;
					}
				}
			}
			anInt1729 = Client.anInt1325 - i_14_;
			if (sequence != null) {
				i_13_ = sequence.anIntArray295[anInt1730];
			}
		}
		ObjectDefinition objectDefinition;
		if ((this).anIntArray1727 != null) {
			objectDefinition = method614(0);
		} else {
			objectDefinition = ObjectDefinition.method434(anInt1720);
		}
		if (objectDefinition == null) {
			return null;
		}
		Model model = objectDefinition.method442(anInt1721, anInt1722,
			anInt1715, anInt1716, anInt1717, anInt1718, i_13_);
		return model;
	}
}
